function getAjaxCities() {
// alert($('#country').val());
var selectedCountry = $('#country').val();

	$.ajax({
			type: "POST",
			url: "leadFormCityCountry",
			data: "selectedCountry="+selectedCountry,
		success: function(response){
			var cities = response.split('***');
			var Ids = cities[0];
			var Names = cities[1];
			var cityIds = Ids.split("?");
			var cityNames = Names.split("?");
			$('#city').html('');
		jQuery.each(cityIds , function(index, value){
			var option = "<option value='" + value + "'>" + cityNames[index] + "</option>";
			$('#city').append(option);
		});
		},
		error: function(e){
		//alert('Error: ' + e);
		}
		});
	}
$(document).ready(function() {
	var validator = $("#accountForm").validate({
		rules: {
			accountName: "required",
			companyName: {
				required: true,
				remote: "validator/checkAccountCompanyExists?accountId=0"
			}
			,phone: {
				required: true,
				remote: "validator/checkAccountPhone?accountId=0",
				number:true
			},
			mobile: {
				number:true
			},
			email: {
				email: true
			},
			zipCode: {
				number: true
			},
			empNum: {
				number: true
			},
			annualRevenue: {
				number: true
			},
			website: {
				url: true
			}
		},
		messages: {
			accountName: {required : $("input#fNameRequired").val()},
			companyName: {
				required: $("input#companyRequired").val(),
			    remote: $("input#companyChecked").val()
			}
			,phone: {
				required: $("input#phoneRequired").val(),
			    remote: $("input#phoneChecked").val(),
			    number: jQuery.format("Enter numbers only")
			},
			mobile: {
			    number: jQuery.format("Enter numbers only")
			},
			zipCode: {
				number: jQuery.format("Enter numbers only")
			},
			email: {
				email: $("input#emailEmail").val()
			},
			empNum: {
				number: jQuery.format("Enter numbers only")
			},
			annualRevenue: {
				number: jQuery.format("Enter numbers only")
			},
			website: {
				url: "adsdsf"
			}
		},
		errorPlacement: function(error, element) {
			error.appendTo(element.next());
		},
		submitHandler: function() {
			 form.submit();
		}
	});
	cancelButtonHandler();
});

/**
 * Cancel button handler
 */
function cancelButtonHandler(){
	$("#cancelButton").click(function() {
		document.location.href='accounts';
	});	
}

